package cn.edu.hunau.java.week02.day02.afternoon;

import org.junit.Test;

public class ShapeTest {
    @Test
    public void test() {
        Shape s1=new Circle(0,0,2);
        System.out.println(s1.area());
        System.out.println(s1.container(1,1));
        if(s1 instanceof Circle){
            Circle c=(Circle)s1;
            System.out.println(c.area());
        }
    }

    @Test
    public void test2() {
        Shape [] arr=new Shape[5];
        arr[0]=new Circle(0,0,2);
        arr[1]=new Rectangle(0,0,2,2);
        arr[2]=new Rectangle(0,0,2,2);
        arr[3]=new Circle(0,0,2);
        arr[4]=new Rectangle(0,0,2,2);
        for(Shape data:arr){
            if(data instanceof Circle){
                System.out.println("圆");
            }
        }
    }
}
